﻿#ifndef SQLITE_H
#define SQLITE_H

#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlError>
#include <QDebug>
#include <QtSql/QSqlQuery>
#include <QList>
#include <QPair>



class sqlite
{
public:
    sqlite();
    ~sqlite();
    const QString nullDate = "0-0-0";
    bool openDatabase(const QString &databasePath);

    bool createTable_week_duration();

    bool insert_week_duration(const QString &name,const qint8& on_week,
                              const QString &begin_time,const QString &end_time,
                              const QString &begin_date,const QString &end_date);
    bool createTable_clock();

    bool insert_clock(const QString &note,const QString& clock_time,const qint8& enable,const qint8 &week_day);

    bool createTable_task();

    bool insert_task(const QString &name,const QString &begin_date,const QString &end_date);

    bool createTable_day_duration();

    bool insert_day_duration(const QString& note,const QString& begin_date,const QString& end_date,const QString& begin_time,const QString& end_time);

    bool createTable_clock_break();

    bool insert_clock_break(const QString& note,const QString& duration,const qint8& enable);

    QSqlDatabase& get_db();
private:
    /**
     * @brief db 数据库操作句柄
     */
    QSqlDatabase db;
};

#endif // SQLITE_H
